package cn.edu.xmu.oomall.customer.model.bo;

import cn.edu.xmu.oomall.core.model.VoObject;
import cn.edu.xmu.oomall.customer.model.po.CustomerPo;
import cn.edu.xmu.oomall.customer.model.vo.CustomerRetVo;
import cn.edu.xmu.oomall.customer.model.vo.SimpleCustomerRetVo;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@Data
/**
 * @author Jiazhe Yuan
 * @date 2021-12-14 12:21:34
 */
public class Customer {

    public enum State {
        /**
         * 正常状态
         */
        NORMAL((byte)0, "正常"),
        /**
         * 封禁
         */
        BANNED((byte)1, "被封禁");

        private byte code;
        private String description;

        private static final Map<Byte, State> STATE_MAP;

        static {
            STATE_MAP = new HashMap<>();
            for (State tmp : values()) {
                STATE_MAP.put(tmp.getCode(), tmp);
            }
        }

        State(byte code, String description) {
            this.code = code;
            this.description = description;
        }

        public State getStateByCode(Integer code) {
            return STATE_MAP.get(code);
        }

        public Byte getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    private Long id;
    private String userName;
    private String password;
    private String name;
    private Long point;
    private Byte state;
    private String email;
    private String mobile;
    private Byte beDeleted;
    private Long creatorId;
    private String creatorName;
    private Long modifierId;
    private String modifierName;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;
}
